// link组件类似a标签，组件接受一个to参数
/* 
* @path: src/hello-vue-router/components/link.js
* @Description: router-link
*/
export default {
    name: 'RouterLink',
    props: {
        to: {
            type: [String, Object],
            require: true
        }
    },
    render(h) {
        const href = typeof this.to === 'string' ? this.to : this.to.path
        const router = this.$router
        console.log('111', router);
        let data = {
            attrs: {
                href: router.mode === 'hash' ? '#' + href : href
            }
        }
        return h('a', data, this.$slots.default)
    }
}